Rio de Janeiro -LRB- CNN -RRB- -- Security for Pope Francis ' visit to Brazil has been raised after an incident involving his motorcade , a Brazilian federal official told CNN .

The papal visit is now classified at the highest level of security -- it was raised to `` high risk '' from `` medium risk '' after his car got stuck in a crowd of enthusiastic followers Monday , the official said .

The source says the problem in part stemmed from the pope instructing drivers not to avoid crowds .

After Francis arrived in Brazil on Monday , he got into a silver hatchback Fiat for the drive from the airport to downtown Rio de Janeiro . Along the route , the vehicle became pinned between a bus and a crush of well-wishers who were reaching into the car to touch the pope .

Federal authorities are now taking a larger role in Francis ' security during his time in Brazil .

Hundreds of thousands of pilgrims from around the globe have come to Rio for World Youth Day , a weeklong festival held every two years . The Vatican told reporters that 500,000 people came to Copacabana Beach for the opening ceremony and Mass. . Crowds stretched down the beach for more than half a mile from the main stage .

Brazil : Police found , destroyed bomb before pope 's visit

A call for hope

The pope traveled Wednesday morning to the town of Aparecida , the site of a shrine to Our Lady of Aparecida , a clay statue of the Virgin Mary and one of the patron saints of Brazil .

A large crowd -- braving rain -- cheered as the pope emerged from the helicopter that took him to the site , where he held Mass. .

In his homily , the pope called on the faithful to find hope in God .

`` It is true that nowadays , to some extent , everyone , including our young people , feels attracted by the many idols which take the place of God and appear to offer hope : money , success , power , pleasure , '' Francis said . `` Often , a growing sense of loneliness and emptiness in the hearts of many people leads them to seek satisfaction in these ephemeral idols . ''

His was an upbeat message , encouraging `` openness to being surprised by God '' and proclaiming that `` Christians can not be pessimists . ''

The pope also announced that he will return to Brazil in 2017 , the 300th anniversary of the apparition of Our Lady of Aparecida to three fishermen .

Singing priests revive Catholic Church in Brazil

CNN 's Mariano Castillo contributed to this report .

@highlight

Security for Pope Francis has been raised to `` high risk ''

@highlight

The designation comes after an incident involving his motorcade

@highlight

The pope shared an upbeat message during Mass on Wednesday